

import 'package:floor/floor.dart';

import '../entity/ProductBean.dart';

@dao
abstract class ProductDao {

  @Query('DELETE FROM ProductBean')
  Future<void> deleteAll();

  @Query('DELETE FROM ProductBean WHERE id = :id')
  Future<void> deleteById(int id);

  @Query('SELECT * FROM ProductBean')
  Future<List<ProductBean>> findAll();

  @Query('SELECT * FROM ProductBean WHERE id = :id')
  Future<ProductBean?> findById(int id);

  @insert
  Future<int> insertOne(ProductBean bean);

  @Update(onConflict: OnConflictStrategy.replace)
  Future<int> updateOne(ProductBean bean);

  @update
  Future<int> updateList(List<ProductBean> beans);

}